﻿using System;
using System.Web.Security;
using System.Web.UI;

namespace UDS.SubModule.Login
{
    /// <summary>
    /// Logout 的摘要说明。
    /// </summary>
    public partial class LogoutPage : Page
    {
        protected override void OnLoad(EventArgs e)
        {
            string Action = (Request.QueryString["Action"] != null) ? Request.QueryString["Action"] : "1";
            // clear everything
            var staff = new Components.Staff();
            staff.Logout(SiteContext.Current.UserName);
            FormsAuthentication.SignOut();
            Request.Cookies.Clear();
            Session.Clear();

            if (Action == "1")
            {
                Response.Write("<script language=javascript>window.close();</script>");
            }
            if (Action == "2")
            {
                Server.Transfer("Index.aspx");
            }

            base.OnLoad(e);
        }
    }
}